來把比大小完成
上面的表格都是用label去建.然後改內容+字形
中間放textbox改內容.改格的高度大小只能用字形
下面是button
猜0-1000的數字
角落的lab_Ans是預計被猜中的數值
第一步:產生隨機的亂數值
Random iDice = new Random();
iDice =亂數名稱
.Next()=產生亂數
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Random iDice = new Random();
            for(int i=1;i<=10;i++)
            {
                lab_Ans.Text += iDice.Next() + "\n";
            }
        }
    }
}
猜出十個
產生50-99的值共50-99+1=50個-使用計算式
Random iDice = new Random();
lab_Ans.Text +=( iDice.Next()%50)+ 50;
語法也可以寫成
lab_Ans.Text += iDice.Next(50, 100);
區域變數:iVal僅存於A程序內
private void A()
{int iVal =50;}
要讓iDice 可以使用就要把
Random iDice = new Random();
搬到private void Form1_Load(object sender, EventArgs e)外

建立全域變數
最大值,最小值,玩家的答案(要清空),電腦的答案
int iMinVal,iMaxVal,iPlyGet,iCptrVal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        private void Form1_Load(object sender, EventArgs e)
        {
            iMaxVal = 0;iMaxVal = 0;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1,1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
取出玩家猜測事件按下後~
對話方塊訊息盒=輸入要顯示的文字訊息
MessageBox.show(輸入要顯示的文字訊息);
後面順便清空
限定數字只能輸入3個
在猜到數字之後遊戲重新開始.所以用"副程式"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        
        private void But_Play_Click(object sender, EventArgs e)
        {
            iPlyGet = int.Parse(tbx_gst.Text);
            if(iPlyGet>iMinVal && iPlyGet<iMaxVal)
            {
                if(iPlyGet == iCptrVal)
                {
                    MessageBox.Show("恭喜輸家出現");
                    vGameStart();
                }
            }
            else
            {
                MessageBox.Show("輸入值錯誤.需介於"+iMinVal+"到"+iMaxVal+"之間");
                tbx_gst.Text += "";
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            vGameStart();
        }
        
        private void vGameStart()
        {
            iMaxVal = 0; iMaxVal = 1000;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1, 1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
每輸入一次縮小範圍..猜對重新開始

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        
        private void But_Play_Click(object sender, EventArgs e)
        {
            iPlyGet = int.Parse(tbx_gst.Text);
            if (iPlyGet > iMinVal && iPlyGet < iMaxVal)
            {
                if (iPlyGet == iCptrVal)
                {
                    MessageBox.Show("恭喜輸家出現");
                    vGameStart();
                }
                else
                {
                    if (iPlyGet > iCptrVal)
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值大於答案");
                        iMaxVal = iPlyGet;
                        lab_Max.Text = iMaxVal.ToString();
                        tbx_gst.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值小於答案");
                        iMinVal = iPlyGet;
                        lab_Max.Text = iMinVal.ToString();
                        tbx_gst.Text = "";
                    }
                }
            }
            else
            {
                MessageBox.Show("輸入值錯誤.需介於"+iMinVal+"到"+iMaxVal+"之間");
                tbx_gst.Text += "";
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            vGameStart();
        }
        
        private void vGameStart()
        {
            iMaxVal = 0; iMaxVal = 1000;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1, 1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
局域變數:
變數i僅存於此for迴圈內
for(int i=1;i<=10;i++)
變數i在for迴圈結束後仍可存取
int i;
for(int i=1;i<=10;i++)
{變數i在for迴圈結束後仍可存取}
將遊戲結束語法:
Application.Exit();
觸動結束鍵
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        
        private void But_Play_Click(object sender, EventArgs e)
        {
            iPlyGet = int.Parse(tbx_gst.Text);
            if (iPlyGet > iMinVal && iPlyGet < iMaxVal)
            {
                if (iPlyGet == iCptrVal)
                {
                    MessageBox.Show("恭喜輸家出現");
                    vGameStart();
                }
                else
                {
                    if (iPlyGet > iCptrVal)
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值大於答案");
                        iMaxVal = iPlyGet;
                        lab_Max.Text = iMaxVal.ToString();
                        tbx_gst.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值小於答案");
                        iMinVal = iPlyGet;
                        lab_Max.Text = iMinVal.ToString();
                        tbx_gst.Text = "";
                    }
                }
            }
            else
            {
                MessageBox.Show("輸入值錯誤.需介於"+iMinVal+"到"+iMaxVal+"之間");
                tbx_gst.Text += "";
            }
        }
        private void But_Exit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void But_Rst_Click(object sender, EventArgs e)
        {
            vGameStart();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            vGameStart();
        }
        
        private void vGameStart()
        {
            iMaxVal = 0; iMaxVal = 1000;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1, 1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
MessageBox.Show("是否結束PLAY?","結束遊戲",MessageBoxButtons.OKCancel,MessageBoxIcon.Question);



判斷是否按OK
            if (MessageBox.Show("是否結束PLAY?", "結束遊戲", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            { Application.Exit(); }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        
        private void But_Play_Click(object sender, EventArgs e)
        {
            iPlyGet = int.Parse(tbx_gst.Text);
            if (iPlyGet > iMinVal && iPlyGet < iMaxVal)
            {
                if (iPlyGet == iCptrVal)
                {
                    MessageBox.Show("恭喜輸家出現");
                    vGameStart();
                }
                else
                {
                    if (iPlyGet > iCptrVal)
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值大於答案");
                        iMaxVal = iPlyGet;
                        lab_Max.Text = iMaxVal.ToString();
                        tbx_gst.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值小於答案");
                        iMinVal = iPlyGet;
                        lab_Max.Text = iMinVal.ToString();
                        tbx_gst.Text = "";
                    }
                }
            }
            else
            {
                MessageBox.Show("輸入值錯誤.需介於"+iMinVal+"到"+iMaxVal+"之間");
                tbx_gst.Text += "";
            }
        }
        private void But_Exit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否結束PLAY?", "結束遊戲", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            { Application.Exit(); }
        }
        private void But_Rst_Click(object sender, EventArgs e)
        {
            vGameStart();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            vGameStart();
        }
        
        private void vGameStart()
        {
            iMaxVal = 0; iMaxVal = 1000;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1, 1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
猜輸是否重開一局
if (MessageBox.Show("是否重開一局?", "輸家出現", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    { vGameStart(); }
                    else
            { Application.Exit(); }
                   
完成版
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _20210409
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Random iDice = new Random();
        int iMinVal, iMaxVal, iPlyGet, iCptrVal;
        
        private void But_Play_Click(object sender, EventArgs e)
        {
            iPlyGet = int.Parse(tbx_gst.Text);
            if (iPlyGet > iMinVal && iPlyGet < iMaxVal)
            {
                if (iPlyGet == iCptrVal)
                {
                    if (MessageBox.Show("是否重開一局?", "輸家出現", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    { vGameStart(); }
                    else
            { Application.Exit(); }
                   
                }
                else
                {
                    if (iPlyGet > iCptrVal)
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值大於答案");
                        iMaxVal = iPlyGet;
                        lab_Max.Text = iMaxVal.ToString();
                        tbx_gst.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("恭喜沒有猜中,您的猜測值小於答案");
                        iMinVal = iPlyGet;
                        lab_Max.Text = iMinVal.ToString();
                        tbx_gst.Text = "";
                    }
                }
            }
            else
            {
                MessageBox.Show("輸入值錯誤.需介於"+iMinVal+"到"+iMaxVal+"之間");
                tbx_gst.Text += "";
            }
        }
        private void But_Exit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否結束PLAY?", "結束遊戲", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            { Application.Exit(); }
        }
        private void But_Rst_Click(object sender, EventArgs e)
        {
            vGameStart();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            vGameStart();
        }
        
        private void vGameStart()
        {
            iMaxVal = 0; iMaxVal = 1000;
            lab_Min.Text = iMinVal.ToString();
            lab_Max.Text = iMaxVal.ToString();
            tbx_gst.Text = "";
            iCptrVal = iDice.Next(1, 1000);
            lab_Ans.Text = iCptrVal.ToString();
        }
        }
    }
雖然我這篇文章目前還沒有追蹤者
但是我還是要來自言自語一下
目前我這個就是藍色的VSCODE和 Visual Studio共筆
其實我也不知道寫到最後會是甚麼就想到甚麼寫甚麼
k8s也有可能?
Kubernetes是IT從來都是一個由新技術驅動的行業。擁抱微服務架構,Kubernates微服務架構有以下的優點,例如:
Kubernetes 可以讓你無需設置一台新的服務器即可在生產系統中運行代碼
對於運行在生產系統中的代碼,Kubernetes 可以提供更好的可見性和可管理性
即便每個 Kubernetes 組件都“掛了”,你的Code將仍然保持運行
Kubernetes 的設計對 bug 很有彈性
在 Kubernetes 之上架設新的分散式系统是非常容易的
Kubernetes 可以使你做一些非常神奇的事情(但並不容易)
DEAR ALL 我們明天見